package com.lync.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lync.domain.ExamPaper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class ExamPaperServiceImpl {

    @Autowired
    private ExamPaperService examPaperService;

    @Test
    void testGetById(){
        System.out.println(examPaperService.getById(1));
    }
    //添加数据
    @Test
    void testSave(){
        ExamPaper examPaper = new ExamPaper();
        examPaper.setId(1);
        examPaperService.save(examPaper);
    }
    //修改数据
    @Test
    void testUpdate(){
        ExamPaper examPaper = new ExamPaper();
        examPaper.setId(1);
        examPaper.setPaperType(1);
        examPaperService.updateById(examPaper);
    }
    //删除
    @Test
    void testDelete(){
        examPaperService.delete(1);
    }
    //查询全部
    @Test
    void testGetAll(){
        examPaperService.getAll();
    }
    //分页
    @Test
    void testGetPage(){
        IPage<ExamPaper> page = examPaperService.getPage(1, 1);
        System.out.println(page.getCurrent());//当前页
        System.out.println(page.getSize());
        System.out.println(page.getTotal());//总共多少条
        System.out.println(page.getPages());//多少页
        System.out.println(page.getRecords());//所有数据
    }


}
